AI Validator for Laravel: Uses ChatGPT (GPT-3.5-turbo) to easily check and filter user inputs.
- PHP 7.2 or higher
- Laravel 6.0 or higher
- Open AI API Key
You can install the package into a Laravel app via composer:
composer require naif/ai-validation
php artisan vendor:publish --provider="Naif\AIValidation\AIValidationServiceProvider"
Create your API Key from https://platform.openai.com/api-keys
Add API Key in .env file
CHATGPT_API_KEY=
Field validation rule
use Naif\AIValidation\Rules\AIValidation;
$request->validate([
'field_name' => [AIValidation::make('ads')],
]);
- Spam: Identifies unsolicited, bulk, or irrelevant messages.
- Nonsense: Flags text that is illogical or meaningless.
- Botcheck: Detects text likely generated by automated bots.
- Emoji Overuse: Catches excessive use of emojis in text.
- Promotional: Highlights promotional or advertising content.
- Ads: Identifies content that is explicitly advertising.
- Swearing: Flags use of profanity or offensive language.
- Hate Speech: Detects speech that promotes hate or discrimination.
- Political Bias: Identifies politically biased or partisan content.
- Adult Content: Flags explicit or sexually suggestive content.
- Secure: Checks for content with potential security risks.
- Phishing: Identifies attempts to acquire sensitive information.
- Personal Info: Detects the presence of private personal data.
Bug Tracker:
https://github.com/naifalshaye/ai-validation/issues/new
The MIT License (MIT). Please see License File for more information.